import {AbstractControl, ValidationErrors, ValidatorFn} from "@angular/forms";

export function phoneCustomizedValidator(): ValidatorFn {
  return (control: AbstractControl): ValidationErrors | null => {

    const value = control.value;
    console.log(/^[1][3,4,5,7,8][0-9]{9}$/.test(value))
    return !/^[1][3,4,5,7,8][0-9]{9}$/.test(value) ? {phoneTypeInvalid: true} : null;
  }
}
